extends ../public/layout
block title
    title 确认订单
block content
    .am-container.white-background
        if addressList.length >0
            .am-g.flex.address-box.addressChoose
                .am-u-sm-1
                    i.am-inline-block.address-icon
                .am-u-sm-10
                    p.am-margin-bottom-0 收货人&nbsp;:&nbsp;#{addressList[0].name}
                        span.am-fr #{addressList[0].tel}
                    p.am-margin-top-0 收货地址&nbsp;:&nbsp;#{addressList[0].province}#{addressList[0].city}#{addressList[0].district}#{addressList[0].address}
                .am-u-sm-1.am-padding-left-0
                    i.am-inline-block.more-icon
        else
            .am-g.flex.address-box.addNewAddress.addNew
                .am-u-sm-11.am-padding-lg
                    i.am-inline-block.add-new-icon.am-margin-right-sm
                    p.md-font.am-inline-block 新增收货地址
                .am-u-sm-1.am-padding-left-0
                    i.am-inline-block.more-icon.am-fr
    .am-container.white-background.am-margin-top-sm.proList
        .am-g.cart-shop-name.border-bottom-add.md-line-height.border-top-add
            .am-u-sm-12
                a(href="/home/#{products[0].storeId}")
                    i.am-inline-block.shop-icon
                    span.gray-color #{products[0].storeName}
        for product in products
            .am-g.cart-shop-pro.border-bottom-add(data-count="#{product.count}" data-productId="#{product.objectId}")
                a(href="/product/#{product.objectId}")
                    img.img-responsive(src = "#{__IMAGE_HOST__}#{product.product.images}")
                div.order-list
                    p.am-margin-top-0.am-margin-bottom.pro-title #{product.product.title}
                    p.am-margin-bottom-0
                        span.md-font ￥
                            i #{product.salePrice}
                        span.am-fr ×
                            i #{product.count}
        .am-g.border-bottom-add.flex
            .am-u-sm-12
                input.am-form-field.am-input-sm.am-padding-left-0#reMark(placeholder="买家留言 在此备注商品信息 规格等" type='text' maxlength=60)
        .am-g.md-line-height
            .am-u-sm-6.gray-color 商品金额:
            .am-u-sm-6.am-text-right #{chooseSumPrice}￥
        .am-g.md-line-height
            .am-u-sm-6.gray-color 运费:
            .am-u-sm-6.am-text-right 0.0￥
        .am-g.md-line-height.border-bottom-add
            .am-u-sm-6.gray-color 合计:
            .am-u-sm-6.am-text-right.money-color.md-font #{chooseSumPrice}￥
    .am-g.cart-fixed.white-background.flex
        .am-u-sm-8
            |合计
            span.lg-font.money-color ￥#{chooseSumPrice}
        .am-u-sm-4.am-padding-0
            a.am-btn.md-font.py-btn#createOrder 结算
    .mask
    .am-container.address-manage.white-background.border-top-add.addressManage
        .am-g.am-text-center.am-padding-sm.border-bottom-add
            .am-u-sm-12 新增收货地址
                span.inline-block.close-icon.am-fr
        .am-g.am-padding-xs.border-bottom-add
            .am-u-sm-3.am-padding-right-0
                span.am-padding-top-xs.am-padding-bottom-xs 收货人
            .am-u-sm-9.am-padding-left-0
                input.am-form-field.am-input-sm.am-padding-xs.am-padding-left-0(placeholder="姓名" name="name")
        .am-g.am-padding-xs.border-bottom-add
            .am-u-sm-3.am-padding-right-0
                span.am-padding-top-xs.am-padding-bottom-xs 联系电话
            .am-u-sm-9.am-padding-left-0
                input.am-form-field.am-input-sm.am-padding-xs.am-padding-left-0(placeholder="手机号或固定电话" name="phone")
        .am-g.am-padding-xs.border-bottom-add.selectAddress
            .am-u-sm-3.am-padding-right-0
                span 选择地区
            .am-u-sm-3.am-padding-left-0
                span.province(data-item="province") 省份
            .am-u-sm-3.am-padding-left-0
                span.city(data-item="city") 城市
            .am-u-sm-3.am-padding-left-0
                span.district(data-item="district") 区县

        .am-g.am-padding-xs.border-bottom-add
            .am-u-sm-3.am-padding-right-0
                span.am-padding-top-xs.am-padding-bottom-xs 详细地址
            .am-u-sm-9.am-padding-left-0
                input.am-form-field.am-input-sm.am-padding-xs.am-padding-left-0(placeholder="街道门牌 无需重复地区信息" name="address")
        .am-g.am-padding-xs.border-bottom-add
            .am-u-sm-3.am-padding-right-0
                span.am-padding-top-xs.am-padding-bottom-xs 邮政编码
            .am-u-sm-9.am-padding-left-0
                input.am-form-field.am-input-sm.am-padding-xs.am-padding-left-0(placeholder="邮政编码（选填）" name="postcode")
        .am-g.am-text-center.am-padding-sm
            .am-u-sm-12.md-font
                button.am-btn.am-round.select-class.am-btn-sm.py-btn#addressBtn(type="button" data-isEdit="false") 保存
            .am-u-sm-12.md-font.am-padding-top-sm
                button.am-btn.am-round.delete-address.white-background.gray-color.am-btn-sm.am-center(type="button") 删除收货地址

    if addressList.length >0
        input(type="hidden" value="#{addressList[0].objectId}" id="addressId")
    else
        input(type="hidden" value="" id="addressId")
    .am-container.address-manage.white-background.border-top-add.addressList
        .am-g.am-text-center.am-padding-sm.border-bottom-add
            .am-u-sm-12 选择收货地址
                span.inline-block.close-icon.am-fr
        each address in addressList
            .am-g.am-padding-sm.border-bottom-add.flex(data-addressinfo ="#{address.objectId}")
                .am-u-sm-1
                    i.am-inline-block.uncheck-icon.addSelect
                .am-u-sm-10.addDetail(data-addressId ="#{address.objectId}", data-name="#{address.name}",data-phone="#{address.tel}",data-province="#{address.province}",data-city="#{address.city}",data-district="#{address.district}",data-address="#{address.address}" ,data-postcode="#{address.postcode}")
                    p.am-margin-0  #{address.name}  &nbsp;&nbsp;#{address.tel}
                    p.gray-color.xs-font.am-margin-0  收获地址: #{address.province}#{address.city}#{address.district}#{address.address}
                .am-u-sm-1
                    i.am-inline-block.edit-icon
        .am-g.am-padding-sm.border-bottom-add.listaddNewAddress.addNew
            .am-u-sm-1
                i.am-inline-block.add-icon
            .am-u-sm-10
                |新增收获地址
            .am-u-sm-1
                i.am-inline-block.more-icon
block javascript
    script(type="text/javascript" src="/public/javascripts/area.js")
    script(type="text/javascript" src="/public/javascripts/pay.js")
    script(type="text/javascript").
        $(function(){
           pay.init();
        });
